package com.zerosky.crm.service.impl;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zerosky.crm.dao.DeviceLogDAO;
import com.zerosky.crm.po.DeviceLog;
import com.zerosky.crm.service.DeviceLogService;
import com.zerosky.crm.util.PageInfo;

/**
 * Activity业务逻辑实现类
 * 
 * @author hugy;
 * @since 2017-06-08
 *
 */
@Service(value="deviceLogService")
public class DeviceLogServiceImpl implements DeviceLogService {

	@Autowired
	private DeviceLogDAO deviceLogDAO; // Activity数据接口


	@Override
	public PageInfo<DeviceLog> getDeviceLogList(Map map) {
		int begin = (((int)map.get("page") - 1) * (int)map.get("pageSize"));
		PageInfo<DeviceLog> page=new PageInfo<DeviceLog>();
		// 写入数据
		map.put("pageNo", begin);
		List<DeviceLog> list =  deviceLogDAO.getDeviceLogList(map);
		page.setList(list);

		int count = deviceLogDAO.countDeviceLog(map);// 获取总记录
		page.setPageCount(count);
		return page;
	}


	@Override
	public int addDeviceLog(DeviceLog deviceLog) throws Exception {
		return deviceLogDAO.addDeviceLog(deviceLog);
	}
}
